package com.pubg.information.mapper;

import com.pubg.information.bean.Members;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface MemberMapper {
    //根据账号查询密码
    @Select("select password from members where account = #{account}")
    public String getPasswordByAccount(String account);

    //根据账号查询昵称
    @Select("select name from members where account = #{account}")
    public String getNameByAccount(String account);

    //注册账号
    @Insert("insert into members (account,password,name) values(#{account},#{password},#{name})")
    public void insMember(String account,String password,String name);

    //根据账号获取账号信息
    @Select("select * from members where account = #{account}")
    public Members getMembersByAccount(String account);

    //根据账号更新账号信息
    @Update("update members set name = #{name}, phone = #{phone}, age = #{age}, brithday = #{brithday} where account = #{account}")
    public void updMember(String name,String phone,String brithday,String age,String account);

    //更新头像
    @Update("update members set img = #{imgUrl} where account = #{account}")
    public void updImgUrl(String imgUrl,String account);
}
